<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>回传记录列表 - {:think\\facade\\Request::param('site_info')['site_title']}</title>
    <meta name="keywords" content="{:think\\facade\\Request::param('site_info')['site_keyword']}">
    <meta name="description" content="{:think\\facade\\Request::param('site_info')['site_describe']}">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/static/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/static/layuiadmin/style/admin.css" media="all">
    <style>
        .layui-table-body .layui-table-cell {
            height: 50px;
        }
        .layui-laypage .layui-laypage-curr .layui-laypage-em{ background-color: #1E9FFF; }
    </style>
</head>
<body>

<div class="layui-fluid">
    <div class="layui-card">

        <div lay-filter="listSearch" class="layui-form layui-card-header layuiadmin-card-header-auto" style="padding:10px 15px;">

            <div class="layui-form-item">


                <div class="layui-inline">
                    <select name="type">
                        <option value="0">回传类型</option>
                        {volist name="backhaul_types" key="k" id="v"}
                        <option value="{$k}">{$v}</option>
                        {/volist}
                    </select>
                </div>

                <div class="layui-inline">
                    <input type="number" name="bl_id" placeholder="请输入回传ID" autocomplete="off" class="layui-input">
                </div>

                <div class="layui-inline">
                    <input type="number" name="uid" placeholder="请输入用户ID" autocomplete="off" class="layui-input">
                </div>

                <div class="layui-inline">
                    <input type="text" name="date_range" placeholder="请选择回传日期" class="layui-input" id="date_range">
                </div>

                <div class="layui-inline">
                    <button class="layui-btn layui-btn-normal layuiadmin-btn-admin" lay-submit lay-filter="LAY-list-front-search">
                        <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                    </button>
                    <button type="button" class="layui-btn layui-btn-primary" lay-submit lay-filter="LAY-reset">重置</button>
                </div>

            </div>

        </div>

        <div class="layui-card-body">

            <table id="LAY-log-manage" lay-filter="LAY-log-manage"></table>


            <script type="text/html" id="table-log-tool">

            </script>

        </div>

    </div>
</div>

<script src="/static/layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: '/static/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index','table','admin','laydate'], function(){

        var $ = layui.$
            ,form = layui.form
            ,table = layui.table
            ,laydate = layui.laydate;

        laydate.render({
            elem: '#date_range'
            ,range: '~' //或 range: '~' 来自定义分割字符
        });

        //监听搜索
        form.on('submit(LAY-list-front-search)', function(data){
            var field = data.field;
            //执行重载
            table.reload('LAY-log-manage', {
                where: field
                ,page: {
                    curr: 1  // 将页码重置为第一页
                }
            });
        });

        form.on('submit(LAY-reset)', function(data){
            form.val("listSearch", {
                "link_id": "",
                "bl_id": "",
                "uid": "",
                "type": "0",
                "date_range": ""
            });
            form.render();
            table.reload('LAY-log-manage', {
                where: {"link_id": "","bl_id": "","uid": "","type": "0","date_range": ""}
                ,page: {
                    curr: 1  // 将页码重置为第一页
                }
            });
        });

        //书籍管理
        table.render({
            elem: '#LAY-log-manage'
            ,url: "{:url('Backhaul/log_data')}" //模拟接口
            ,autoSort: false
            ,cols: [[
                {field: 'type', title: '回传类型', sort: true, align:'center'}
                ,{field: 'bl_id', title: '回传ID', align:'center'}
                ,{field: 'uid', title: '用户ID', align:'center'}
                ,{field: 'request_data', title: '回传数据', align:'center'}
                ,{field: 'response', title: '返回结果', minWidth: 100, align:'center'}
                ,{field: 'create_time', title: '回传时间', minWidth: 100, align:'center'}
            ]]
            ,page: true
            ,limit: 30
            ,height: 'full-220'
            ,text: '对不起，加载出现异常！'
        });

        //触发排序事件
        table.on('sort(LAY-log-manage)', function(obj){

            table.reload('LAY-log-manage', {
                initSort: obj //记录初始排序，如果不设的话，将无法标记表头的排序状态。
                ,where: { //请求参数（注意：这里面的参数可任意定义，并非下面固定的格式）
                    field: obj.field //排序字段
                    ,order: obj.type //排序方式
                }
            });

        });

    });
</script>

</body>
</html>